package org.example.yolodemo.controller;


import org.example.yolodemo.entity.ImageDetection;
import org.example.yolodemo.service.ImageDetectionService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;


import java.util.List;


@Controller
public class VController {


    private final ImageDetectionService imageDetectionService;

    public VController(ImageDetectionService imageDetectionService) {
        this.imageDetectionService = imageDetectionService;
    }

    @GetMapping("/visualization")
    public String showVisualization(Model model) {
        List<ImageDetection> detections = imageDetectionService.getAllDetections();
        model.addAttribute("detections", detections);
        return "visualization"; // 对应上面的HTML文件名(不带.html)
    }
}
